package com.jd.dl.web.filter;

import com.jd.dl.dao.constant.QueryConstants;
import com.jd.dl.util.CharacterEncodingUtil;
import com.jd.dl.util.Filter;

public class TaskFilter extends Filter {

	private Item taskId				= new Item(QueryConstants.Task.TASK_ID, null, QueryConstants.LIKE);
	private Item taskName			= new Item(QueryConstants.Task.TASK_NAME, null, QueryConstants.LIKE);
	private Item startTime			= new Item(QueryConstants.Task.START_TIME, null, QueryConstants.LIKE);
	private Item endTime			= new Item(QueryConstants.Task.END_TIME, null, QueryConstants.LIKE);
	private Item taskAddress		= new Item(QueryConstants.Task.TASK_ADDRESS, null, QueryConstants.LIKE);
	private Item taskLat			= new Item(QueryConstants.Task.TASK_LATITUDE, null, QueryConstants.LIKE);
	private Item taskLon			= new Item(QueryConstants.Task.TASK_LONGITUDE, null, QueryConstants.LIKE);
	private Item taskStatus			= new Item(QueryConstants.Task.TASK_STATUS, null, QueryConstants.LIKE);
	private Item user				= new Item(QueryConstants.Task.USER, null, null);
	private Item taskDetails		= new Item(QueryConstants.Task.TASK_DETAILS, null, QueryConstants.LIKE);
	
	
	public String getAny() {
		return "";
	}
	public void setAny(String any) {
		this.setJoinWithAnd(false);
		this.taskId.setValue(CharacterEncodingUtil.iso2utf8(any));
		this.taskName.setValue(CharacterEncodingUtil.iso2utf8(any));
		this.startTime.setValue(CharacterEncodingUtil.iso2utf8(any));
		this.endTime.setValue(CharacterEncodingUtil.iso2utf8(any));
		this.taskAddress.setValue(CharacterEncodingUtil.iso2utf8(any));
		this.taskLat.setValue(CharacterEncodingUtil.iso2utf8(any));
		this.taskLon.setValue(CharacterEncodingUtil.iso2utf8(any));
		this.taskStatus.setValue(CharacterEncodingUtil.iso2utf8(any));
		if(any != null && !any.equals("")){
			this.user.setValue(null);
			this.user.setExpOnly(true);
			this.user.setExp("this.user in (select userId from com.jd.dl.pojo.User where PHONE_NUMBER like '%"+CharacterEncodingUtil.iso2utf8(any)+"%')");
		}
		this.taskDetails.setValue(CharacterEncodingUtil.iso2utf8(any));
	}

}
